package com.chis.client;

import com.alibaba.fastjson.JSONObject;

import java.util.HashMap;
import java.util.Map;

/**
 * 
 * @Description 
 * @Company zwx
 * @author wlj
 * @version 2019年12月20日
 */
public class Test {
    public static void main(String[] args) {
        callXieTong("10","1016","/maindata/1016.xml");
    }

    public static void callXieTong(String event_type,String subType,String fileName){
        try{
            Map<String,Object> reqMap= new HashMap<>(16);
            reqMap.put( "event_id", UuidUtil.uuid());
            reqMap.put( "event_type", event_type);
            String content= StreamUtil.getStreamStr( fileName);

            EventPojo pojo= new EventPojo();
            pojo.setUscId( "915425003213606051");
            pojo.setSubType( subType);
            pojo.setData( content);

            BuildParam.createSign( "f190e80b176947ac9dc9466029c7b669", "27e11a04ea0f43609b20dcc3e8ba2204", reqMap, JSONObject.toJSONString( pojo));

            Map<String,Object> requestMap= new HashMap<>(4);
            requestMap.put( "req", reqMap);
            String bodyStr= JSONObject.toJSONString( requestMap);
            System.out.println(bodyStr);

            String result= HttpClientUtil.postRequest( "https://xietong.open.test.tcsy.com.cn/open/api", null, null, bodyStr);
            System.out.println( result);
        }catch ( Exception e){
            e.printStackTrace();
        }
    }
}
